package com.tjetc.hw;

import java.util.Scanner;

public class 棋盘 {
    public static void main(String[] args) {
        int[][] dp = new int[5][9];
        Scanner in = new Scanner(System.in);
        int houseX=in.nextInt();
        int houseY=in.nextInt();
        int[][] step=new int[][]{
                {-1,-2},{-2,-1},{-2,1},{-1,2},
                {1,2},{2,1},{2,-1},{1,-2}
        };//马能走的点
        for (int i = 0; i < step.length; i++) {
            if (houseX+step[i][0]>=0&&houseX+step[i][0]<5 && houseY+step[i][1]>=0&&houseY+step[i][1]<9){
                dp[houseX+step[i][0]][houseY+step[i][1]]=-1;
            }
        }
        int k1=1;
        for (int i = 0; i < 5; i++) {
            if (dp[i][0]==-1){
                k1=0;
            };
            dp[i][0]=k1;
        }
        int k2=1;
        for (int i = 0; i < 9; i++) {
            if (dp[0][i]==-1){
                k2=0;//如果有马挡路为0,后边的也为0
            }
            dp[0][i]=k2;
        }
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 9; j++) {
                System.out.print(dp[i][j]+" ");
            }
            System.out.println();
        }

        for (int i = 1; i < 5; i++) {
            for (int j = 1; j < 9; j++) {
                if (dp[i][j]==-1){
                    dp[i][j] =0;
                }else{
                dp[i][j] = dp[i-1][j]+dp[i][j-1];}
            }
        }
        System.out.println(dp[4][8]);
    }
}
